<template>
  <div class="item">
    <div class="user">
      <image :src="data.avatar" mode="aspectFill" />
      <div class="name">{{ data.name }}</div>
      <div class="time">{{ data.createTime }}</div>
    </div>
    <div class="content">{{ data.title }}</div>
    <div class="imgs">
      <template v-for="(item, index) in imgUrls" :key="index">
        <image
          :src="item"
          mode="aspectFill"
          @click="previewImage(index, imgUrls)"
          v-if="index < 3"
        />
      </template>
    </div>
  </div>
</template>
<script setup lang="ts">
import { imgsSplit, previewImage } from '@/utils/index'

defineOptions({ name: 'Trend' })
const props = defineProps(['data'])

const imgUrls = imgsSplit(props.data.imgUrls)
</script>
<style lang="scss" scoped>
.item {
  padding: 20rpx;
  margin-bottom: 26rpx;
  background-color: #fff;
  border-radius: 30rpx;
  &:last-child {
    margin-bottom: 0;
  }
  .user {
    display: flex;
    align-items: center;
    height: 73rpx;
    image {
      width: 73rpx;
      height: 73rpx;
      background-color: var(--bgc1);
      border-radius: 50%;
    }
    .name {
      flex: 1;
      margin-left: 20rpx;
      font-size: 30rpx;
      color: var(--color1);
    }
    .time {
      font-size: 23rpx;
      color: var(--color4);
    }
  }
  .content {
    margin-top: 20rpx;
    font-size: 27rpx;
    line-height: 38rpx;
    color: var(--color1);
  }
  .imgs {
    display: flex;
    justify-content: space-between;
    margin-top: 20rpx;
    image {
      width: 204rpx;
      height: 204rpx;
      border-radius: 23rpx;
    }
  }
}
</style>
